Package com.netscape.certsrv.logging
Class LogEvent
java.lang.Object
com.netscape.certsrv.logging.LogEvent
- Direct Known Subclasses:
AuditEvent
,SignedAuditEvent
A class which all loggable events must extend. CMS comes
with a limited set of LogEvent types to implement: audit, system, and
signed audit. This is the base class of all the subsequent implemented types.
A log event represents a certain kind of log message designed for a specific purpose.
For instance, an audit type event represents messages having to do with auditable CMS
actions. The resulting message will ultimately appear into a specific log file.
-
Constructor Summary
ConstructorsConstructorDescriptionLogEvent()
Constructs a message from a base exception.Constructs a message eventConstructs a message from an exception.Constructs a message event with a list of parameters that will be substituted into the message format.Constructs a message with a parameter. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves log event type.int
getLevel()
Retrieves log level.Returns the current message format string.boolean
Retrieves log multiline attribute.int
Retrieves NT specific log event type.Object[]
Returns a list of parameters.Retrieves log source.long
Retrieves event time stamp.void
setEventType
(String eventType) Sets log event type.void
setLevel
(int level) Sets log level, NT log event type.void
setMessage
(String message) void
setMultiline
(boolean multiline) Sets log multiline attribute.void
setParameters
(Object[] params) Sets audit event's parameters.void
Sets log source.toString()
Return string representation of log message.
-
Constructor Details
-
LogEvent
public LogEvent() -
LogEvent
Constructs a message event- Parameters:
msgFormat
- the message string
-
LogEvent
Constructs a message with a parameter. For example,new AuditEvent("failed to load {0}", fileName);
- Parameters:
msgFormat
- details in message string formatparam
- message string parameter
-
LogEvent
Constructs a message from an exception. It can be used to carry a system exception that may contain information about the context. For example,try { ... } catch (IOExeption e) { logHandler.log(new AuditEvent("Encountered System Error {0}", e); }
- Parameters:
msgFormat
- exception details in message string formatexception
- system exception
-
LogEvent
Constructs a message from a base exception. This will use the msgFormat from the exception itself.try { ... } catch (Exception e) { logHandler.log(new AuditEvent(e)); }
- Parameters:
e
- CMS exception
-
LogEvent
Constructs a message event with a list of parameters that will be substituted into the message format.- Parameters:
msgFormat
- message string formatparams
- list of message format parameters
-
-
Method Details
-
getMessage
Returns the current message format string.- Returns:
- details message
-
setMessage
-
getParameters
Returns a list of parameters.- Returns:
- list of message format parameters
-
setParameters
Sets audit event's parameters. -
getSource
Retrieves log source. This is the subsystem responsible for creating the log event.- Returns:
- log source.
-
setSource
Sets log source.- Parameters:
source
- the component source where this message event was triggered
-
getLevel
public int getLevel()Retrieves log level. The log level of an event represents its relative importance or severity within CMS.- Returns:
- Integer log level value.
-
getNTEventType
public int getNTEventType()Retrieves NT specific log event type.- Returns:
- Integer NTEventType value.
-
setLevel
public void setLevel(int level) Sets log level, NT log event type. For certain log levels the NT log event type gets set as well.- Parameters:
level
- Integer log level value.
-
getMultiline
public boolean getMultiline()Retrieves log multiline attribute. True if this message consists of more than one line.- Returns:
- Boolean of multiline status.
-
setMultiline
public void setMultiline(boolean multiline) Sets log multiline attribute. A multiline message consists of more than one line.- Parameters:
multiline
- Boolean multiline value.
-
getTimeStamp
public long getTimeStamp()Retrieves event time stamp.- Returns:
- Long integer of the time the event was created.
-
getEventType
Retrieves log event type. Each type of event has an associated String type value.- Returns:
- String containing the type of event.
-
setEventType
Sets log event type. Each type of event has an associated String type value.- Parameters:
eventType
- String containing the type of event.
-
toString
Return string representation of log message.
-